package com.ruoyi.contract.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.contract.domain.ContractPlanInfo;
import com.ruoyi.contract.mapper.ContractPlanInfoMapper;
import com.ruoyi.contract.service.IContractPlanInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 合同计划Service业务层处理
 *
 * @author ruoyi
 * @date 2022-08-31
 */
@Service
public class ContractPlanInfoServiceImpl implements IContractPlanInfoService {
    @Autowired
    private ContractPlanInfoMapper contractPlanInfoMapper;

    /**
     * 查询合同计划
     *
     * @param planId 合同计划主键
     * @return 合同计划
     */
    @Override
    public ContractPlanInfo selectContractPlanInfoByPlanId(String planId) {
        return contractPlanInfoMapper.selectContractPlanInfoByPlanId(planId);
    }

    /**
     * 查询合同计划列表
     *
     * @param contractPlanInfo 合同计划
     * @return 合同计划
     */
    @Override
    public List<ContractPlanInfo> selectContractPlanInfoList(ContractPlanInfo contractPlanInfo) {
        return contractPlanInfoMapper.selectContractPlanInfoList(contractPlanInfo);
    }

    /**
     * 新增合同计划
     *
     * @param contractPlanInfo 合同计划
     * @return 结果
     */
    @Override
    public int insertContractPlanInfo(ContractPlanInfo contractPlanInfo) {
        contractPlanInfo.setCreateTime(DateUtils.getNowDate());
        return contractPlanInfoMapper.insertContractPlanInfo(contractPlanInfo);
    }

    /**
     * 修改合同计划
     *
     * @param contractPlanInfo 合同计划
     * @return 结果
     */
    @Override
    public int updateContractPlanInfo(ContractPlanInfo contractPlanInfo) {
        contractPlanInfo.setUpdateTime(DateUtils.getNowDate());
        return contractPlanInfoMapper.updateContractPlanInfo(contractPlanInfo);
    }

    /**
     * 批量删除合同计划
     *
     * @param planIds 需要删除的合同计划主键
     * @return 结果
     */
    @Override
    public int deleteContractPlanInfoByPlanIds(String[] planIds) {
        return contractPlanInfoMapper.deleteContractPlanInfoByPlanIds(planIds);
    }

    /**
     * 删除合同计划信息
     *
     * @param planId 合同计划主键
     * @return 结果
     */
    @Override
    public int deleteContractPlanInfoByPlanId(String planId) {
        return contractPlanInfoMapper.deleteContractPlanInfoByPlanId(planId);
    }
}
